<ui:composition template="/WEB-INF/template/layoutPadrao.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="titulo">Novo Empenho</ui:define>

	<f:metadata>
		<f:viewParam name="empenho" value="#{cadastroEmpenhoBean.empenho}" />
	</f:metadata>


	<ui:define name="corpo">
		<h:form>
			<h1>Novo Empenho</h1>

			<p:messages autoUpdate="true" closable="true" />

			<p:toolbar style="margin-top:20px">
				<p:toolbarGroup>
					<p:button value="Novo" outcome="/empenhos/cadastroEmpenho" />
					<p:commandButton value="Salvar" id="botaoSalvar"
						action="#{cadastroEmpenhoBean.salvar}" update="@form" />
				</p:toolbarGroup>

				<p:toolbarGroup align="right">
					<p:button value="Pesquisa" outcome="/empenhos/pesquisaEmpenho" />
				</p:toolbarGroup>
			</p:toolbar>

			<p:panelGrid columns="4" id="painel"
				style="width:100%; margin-top:20px" columnClasses="rotulo, campo">

				<p:outputLabel value="Emissão" for="emissao" />
				<p:calendar size="10" id="emissao" pattern="dd/MM/yyyy"
					value="#{cadastroEmpenhoBean.empenho.dataEmpenho}" effect="explode" />

				<p:outputLabel value="Numero do Empenho" for="numero" />
				<p:inputText value="#{cadastroEmpenhoBean.empenho.empenhoNumero}"
					id="numero" maxlength="12" />

				<p:outputLabel value="Empresa" for="empresa" />
				<p:autoComplete id="empresa" size="60" dropdown="true"
					value="#{cadastroEmpenhoBean.empenho.empresa}"
					completeMethod="#{cadastroEmpenhoBean.completarEmpresa}"
					forceSelection="true" var="empresa" itemValue="#{empresa}"
					itemLabel="#{empresa.nome}" />

				<p:outputLabel value="Processo de Origem" for="origem" />
				<p:inputText value="#{cadastroEmpenhoBean.empenho.processoOrigem}"
					id="origem" maxlength="11" />

				<p:outputLabel value="Tipo de Empenho" for="tipoEmpenho" />
				<p:selectOneMenu id="tipoEmpenho"
					value="#{cadastroEmpenhoBean.empenho.tipoEmpenho}">
					<f:selectItem itemLabel=":: Selecione ::" />
					<f:selectItems value="#{cadastroEmpenhoBean.tipoEmpenhos}"
						var="tipo" itemValue="#{tipo}" itemLabel="#{tipo}" />
				</p:selectOneMenu>

				<p:outputLabel value="Tipo de Modalidade" for="tipoModalidade" />
				<p:selectOneMenu id="tipoModalidade"
					value="#{cadastroEmpenhoBean.empenho.tipoModalidade}">
					<f:selectItem itemLabel=":: Selecione ::" />
					<f:selectItems value="#{cadastroEmpenhoBean.tipoModalidade}"
						var="modalidade" itemValue="#{modalidade}"
						itemLabel="#{modalidade.descricao}" />
				</p:selectOneMenu>


				<p:outputLabel value="Processo" for="processo" />
				<p:inputMask id="processo" mask="99999999999999999"
					value="#{cadastroEmpenhoBean.empenho.processo}" />

				<p:outputLabel value="Valor do Empenho" for="valorTotal" />
				<p:inputText id="valorTotal" size="10" maxlength="100"
					styleClass="moeda"
					value="#{cadastroEmpenhoBean.empenho.valorTotal}">
					<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
				</p:inputText>


			</p:panelGrid>
		</h:form>
	</ui:define>
</ui:composition>